<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>ECSHOP 管理中心</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="/sys-admin/css/general.css" rel="stylesheet" type="text/css">
<link href="/sys-admin/css/main.css" rel="stylesheet" type="text/css">
<script src="/sys-admin/js/jquery.js" type="text/javascript"></script>
<script src="/sys-admin/js/list.js" type="text/javascript"></script>
</head>
<body>
<h1>
<span class="action-span"><a href="/sys-admin/action/auth/admin.php?met=addui">添加管理员</a></span>
<span class="action-span1">管理员管理</span>
</h1>
<!-- 商品搜索 -->
<div class="form-div">
    <select list="search" ltype='1' lfield="role_id">
     <option selected="selected" value="">所有角色</option>
     <{foreach from=$roles item=role}> 
		<option value="<{$role.2}>" <{if $sh.role_id.v eq $role.2}>selected="selected"<{/if}>><{$role.0}></option>
	 <{/foreach}> 
    </select>
    <select list="search" ltype='1' lfield="is_active">
    <option selected="selected" value="">状态</option>
    <option value="1" <{if $sh.is_active.v eq '1'}>selected="selected"<{/if}>>可用</option>
    <option value="0" <{if $sh.is_active.v eq '0'}>selected="selected"<{/if}>>停用</option>
    </select>
    <span>用户名</span><input size="15" value="<{$sh.username.v}>" type="text" list="search" ltype='2' lfield="username">
    <input value="搜索 " class="button" type="button" onclick="to_html();">
</div>
<input id="sort_field" value="<{$sortfield}>" type="hidden">
<input id="sort_val" value="<{$sortval}>" type="hidden">


<div class="list-div" id="listDiv">
<table cellpadding="3" cellspacing="1">
  <tbody><tr>
    <th class="chks">
      <input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox">
    </th>
    <th class="num">#</th>
    <th>用户名</th>
    <th>姓名</th>
    <th>电话</th>
    <th>邮箱</th>
    <th>状态</th>
    <th>所属角色</th>
    <th><a href="javascript:void(0);" name="sort" field="created">创建时间</a>
    <{if $sortfield == 'created'}><{if $sortval==1}><span class="sort_asc"></span><{else}><span class="sort_desc"></span><{/if}><{/if}></th>
    <th><a href="javascript:void(0);" name="sort" field="logdate">最后登录时间</a>
    <{if $sortfield == 'logdate'}><{if $sortval==1}><span class="sort_asc"></span><{else}><span class="sort_desc"></span><{/if}><{/if}></th>
    <th>操作</th>
  </tr>
  <{section name=user loop=$users}> 
	  <tr class="share">
	    <td><input name="checkboxes[]" value="1" type="checkbox"></td>
	  	<td class="num"><{$smarty.section.user.index+1}></td>  
	    <td><a href="#"><{$users[user].username}></a></td>  
	    <td><{$users[user].realname}></td>  
	    <td><{$users[user].phone}></td>  
	    <td><{$users[user].email}></td> 
	    <td><{if $users[user].is_active eq 1}>可用<{else}>停用<{/if}></td> 
	    <td><{$users[user].rolename}></td>  
	    <td><{$users[user].created|date_format:'%Y-%m-%d %H:%M:%S'}></td>  
	    <td><{$users[user].logdate|date_format:'%Y-%m-%d %H:%M:%S'}></td>  
	    <td>
	    <a href="/sys-admin/action/auth/admin.php?met=editui&id=<{$users[user].user_id}>" class="oper_edit" title="编辑" ></a>
        <a href="javascript:delAdmin(<{$users[user].user_id}>,'<{$users[user].username}>');" class="oper_trash" title="删除" ></a>
		</td> 
	   </tr>
   <{/section}>
  </tbody></table>
<!-- end goods list -->
<{include file="../common/page.htm"}>  
</div>
<script type="text/javascript">
var page_url = '/sys-admin/action/auth/admin.php?met=list';
function delAdmin(userId,name){
	if(confirm("您确定要删除'"+name+"'?")){
		$.get('/sys-admin/action/auth/admin.php?met=delete&id='+userId+'&t='+(new Date().getTime()),null,function(result){
			if($.trim(result) == "1"){
				alert("删除'"+name+"'成功");
				document.location.reload();
			}else{
				alert("删除'"+name+"'失败");
			}
		});
	}
}
</script>
</body></html>